package com.xoa.controller.document;

import com.xoa.service.document.OutDocumentService;
import com.xoa.util.ToJson;
import com.xoa.util.page.PageParams;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by Administrator on 2018/3/30.
 */
@Controller
@RequestMapping("/outDocument")
public class OutDocumentController {

    @Autowired
    OutDocumentService outDocumentService;

    @RequestMapping("/index")
    public String goIndex() {
        return "app/outDocument/index";
    }

    /**
     * 作者: 张航宁
     * 日期: 2018/4/9
     * 说明: 获取公文列表接口
     */
    @ResponseBody
    @RequestMapping("/getHttpDocuments")
    public JSONObject getHttpDocuments(String userId, PageParams page) {
        return outDocumentService.getHttpDocuments(userId, page);
    }

    /**
     * 作者: 张航宁
     * 日期: 2018/4/9
     * 说明: 根据id获取接口 id为businessKey
     */
    @ResponseBody
    @RequestMapping("/getDocById")
    public JSONObject getDocById(String userId, String id) {
        return outDocumentService.getDocById(userId, id);
    }

    /**
     * 作者: 张航宁
     * 日期: 2018/4/9
     * 说明: 接收接口
     */
    @ResponseBody
    @RequestMapping("/receiveDoc")
    public ToJson<Object> receiveDoc(HttpServletRequest request, HttpServletResponse response, String userId, String id, String taskId, String flag, String beginUser, String jingbanUser) {
        return outDocumentService.receiveDoc(request, response, userId, id, taskId, flag, beginUser, jingbanUser);
    }

}
